﻿using System;
using System.Collections.Generic;
using System.Threading;
using MWS.Processing.Interfaces;
using MWS.Processing.Queues;
using MWS.Processing.Runners;
using ThrottledProcessing.SampleApplication.Messages;
using ThrottledProcessing.SampleApplication.Processors;
using ThrottledProcessing.SampleApplication.Services;

namespace ThrottledProcessing.SampleApplication
{
    internal class Program
    {
        private static void Main()
        {
            var loggingService = new ConsoleLoggingService();

            //var queue = new MemoryQueue<ProcessEventRequest>();
            var queue = new WindowsAzureQueue<ProcessEventRequest>();

            var runner = new ProcessRunner(new List<IProcessor>
                                               {
                                                   
                                                   new UpcomingBillEventEnqueueProcessor(loggingService, queue)
                                                       {
                                                           ProcessRequestsMaxParallel = 8,
                                                           GetRequestsRate = 10000,
                                                           ProcessRequestsRate = 1000,
                                                           RequestQueueSize = 10
                                                       },
                                                     /*
                                                   new ProcessEventProcessor(loggingService, queue)
                                                       {
                                                           ProcessRequestsMaxParallel = 10,
                                                           GetRequestsRate = 30000,
                                                           ProcessRequestsRate = 1000,
                                                           RequestQueueSize = 20
                                                       },
                                                   new DocumentIndexingProcessor(loggingService)*/
                                               });

            runner.Start();

            Thread.Sleep(3000000);

            runner.Stop();

            Console.ReadKey();
        }
    }
}